﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace MediaBot.Entities
{
    public class MatchHelper
    {
        /// <summary>
        /// Get string from XmlNode with MatchType null checking
        /// </summary>
        /// <param name="matchType"></param>
        /// <param name="mainNode"></param>
        /// <param name="nsmng"></param>
        /// <returns></returns>
        public static string GetString(MatchType matchType, XmlNode mainNode, XmlNamespaceManager nsmng)
        {
            if (matchType == null)
                return null;
            if (mainNode == null)
                throw new ArgumentNullException("mainNode");

            return matchType.GetString(mainNode, nsmng);
        }

        public static XmlNode GetXmlNode(MatchType matchType, XmlNode mainNode, XmlNamespaceManager nsmng)
        {
            if (matchType == null)
                return null;
            if (mainNode == null)
                throw new ArgumentNullException("mainNode");

            return matchType.GetXmlNode(mainNode, nsmng);
        }

        public static string GetHtmlString(MatchType matchType, XmlNode mainNode, XmlNamespaceManager nsmng)
        {
            if (matchType == null)
                return null;
            if (mainNode == null)
                throw new ArgumentNullException("mainNode");

            return matchType.GetHtmlString(mainNode, nsmng);
        }
    }
}
